package com.fau.hm.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.json.simple.JSONAware;
import org.json.simple.JSONObject;

/**
 * @desc 订单字典表
 * @author liy
 * @datetime 2014年9月12日,下午3:32:35
 */
@Entity
@Table(name = "medical_orders_key_value")
public class MedicalOrdersKeyValue implements Serializable, JSONAware{

	private static final long serialVersionUID = 5991509523311833401L;

	private String id;
	private String pid;			// 父id
	private String typeName;	// 类型
	private String keyName;		// 字典key
	private String keyValue;	// 字典值
	private String hospitalId;	//医院标识
	
	private Date createTime = new Date();	// 创建时间
	private Date updateTime = new Date();	// 修改时间
	
	@Id
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@GeneratedValue(generator = "generator")
	@Column(name = "id", length = 32)
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	@Column(name = "pid", length = 32)
	public String getPid() {
		return pid;
	}
	
	public void setPid(String pid) {
		this.pid = pid;
	}
	
	@Column(name = "type_name", length = 50)
	public String getTypeName() {
		return typeName;
	}
	
	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}
	
	@Column(name = "key_name", length = 20)
	public String getKeyName() {
		return keyName;
	}
	public void setKeyName(String keyName) {
		this.keyName = keyName;
	}
	
	@Column(name = "key_value", length = 50)
	public String getKeyValue() {
		return keyValue;
	}
	
	public void setKeyValue(String keyValue) {
		this.keyValue = keyValue;
	}
	
	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_time")
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	@Column(name = "hospital_id", length = 32)
	public String getHospitalId() {
		return hospitalId;
	}

	public void setHospitalId(String hospitalId) {
		this.hospitalId = hospitalId;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String toJSONString() {
		JSONObject obj = new JSONObject();
		obj.put("id", id);
		obj.put("pid", pid);
		obj.put("typeName", typeName);
		obj.put("keyName", keyName);
		obj.put("keyValue", keyValue);
		return obj.toString();
	}
}
